<template>
 <div>
   <div class="loading" v-if="loading">
     数据加载中…
    </div>
    <div id="recommend" v-if="!loading">
    <el-carousel :interval="3000" type="card" height="200px">
      <el-carousel-item v-for="i in banners" :key="i.id">
        <img :src="i.imageUrl" alt="" />
      </el-carousel-item>
    </el-carousel>
    <div class="recommendSongList">
      <div class="title">推荐歌单 ></div>

      <Repeat :songlist="recommendSongList">
        <div class="mysongbox" slot="recommend" @click="demo">
          <div class="cover">
            <img :src="daily" alt="" 
            @mousemove="show()"
            @mouseout="hidden()"/>
          </div>
          <div class="info">每日歌曲推荐</div>
          <div class="play" v-show="showPlay" @mousemove="show()">
            <span class="icon-bofang"></span>           
          </div>
          <div class="calendar" @mousemove="show()">
              <div class="vertical1"></div>
              <div class="vertical2"></div>
              <div class="transverse"></div>
              <div class="date">{{date}}</div>
            </div>
        </div>
      </Repeat>
    </div>
  </div>
 </div>
</template>

<script>
import axios from "axios";
import Repeat from "../pages/Repeat.vue";
import DailyList from "../pages/DailyList.vue";
export default {
  name: "Recommend",
  components: { Repeat },
  data() {
    return {
      loading:true,

      daily: require("../assets/daily.jpg"),
      banners: [],
      recommendSongList: [],
      isShow: true,
      showPlay:false,
      date:""
    };
  },
  methods: {
    demo() {
      this.$bus.$emit("todaily");
    },
    show(){
      this.showPlay = true
    },
    hidden(){
      this.showPlay = false
    }
  },
  mounted() {

    this.date = new Date().getDate()

    axios.get("http://localhost:8013/api/banner?type=0").then((res) => {
      this.banners = res.data.banners;
    });
    axios.get("http://localhost:8013/api/personalized?limit=11").then((res) => {
      this.recommendSongList = res.data.result;
      this.loading = false
    });
  },
};
</script>

<style scoped>
#recommend {
  padding-bottom: 70px;
}
.el-carousel {
  width: 1100px;
  margin: auto;
  line-height: 30px;
}
.el-carousel img {
  width: 100%;
  border-radius: 10px;
}
.recommendSongList {
  padding: 0 10px;
  line-height: 20px;
}
.recommendSongList .title {
  text-align: left;
  height: 30px;
  line-height: 30px;
  font-weight: 600;
  padding-left: 30px;
}

.calendar {
  width: 80px;
  height: 70px;
  margin: 25px 20px 0 40px;
  float: left;
  border: 4px solid #fff;
  border-radius: 20px;
  position: relative;
  top: -210px;
  left: 7px;
}
.calendar .vertical1,
.calendar .vertical2 {
  width: 4px;
  height: 20px;
  position: absolute;
  background: #fff;
  top: -10px;
}
.calendar .vertical1 {
  left: 20px;
}
.calendar .vertical2 {
  left: 56px;
}
.calendar .transverse {
  width: 50px;
  height: 4px;
  background: #fff;
  position: absolute;
  top: 18px;
  left: 15px;
}
.calendar .date {
  width: 80px;
  height: 70px;
  text-align: center;
  line-height: 90px;
  font-size: 30px;
  font-weight: 600;
  color: #fff;
}
</style>